﻿// SMIL is a community project available under the Microsoft Public License (Ms-PL)
// Code is provided as is and with no warrenty – Use at your own risk
// View the project and the latest code at http://smil.codeplex.com/

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace SMIL.Server.CoordinateDataField
{
    public class CoordinateFieldontrol : BaseTextField
    {
        protected Label lCoordinate;

        protected override string DefaultTemplateName
        {
            get
            {
                return "CoordinateEdit";
            }
        }

        public override string DisplayTemplateName
        {
            get
            {
                return "CoordinateView";
            }
            set
            {
                base.DisplayTemplateName = value;
            }
        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            lCoordinate = (Label)TemplateContainer.FindControl("lCoordinate");

            if (ControlMode == SPControlMode.Display)
            {
                if (ItemFieldValue != null)
                    lCoordinate.Text = ItemFieldValue.ToString();
            }
        }
    }
}
